package com.cavedroid;

import javax.microedition.khronos.opengles.GL10;

public class Collectible {	
	private static final int DIMS = 3;
	
	public static final float SIZE = 1;
	
	private static final int VERTEX_COUNT = 24;
	
	private float xSkew;
	
	private float zSkew;
	
	private float[] colour = {0, 1, 1};
	
	public boolean visible = false;
	
	public float xPos;
	
	public float yPos;
	
	public float zPos;
	
	public CubeDrawer cube;
	
	public Collectible(CubeDrawer cubeDrawer) {
		cube = cubeDrawer;
	}
	
	public void position(float x, float y, float z) {
		xPos = x;
		yPos = y;
		zPos = z;	
		xSkew = (float) (Math.random()*90);
		zSkew = (float) (Math.random()*90);
		visible = true;
	}
	
	public float rotation = 0;
	
	public void draw(GL10 gl) {
		gl.glPushMatrix();
		gl.glTranslatef(xPos, yPos, zPos);
		gl.glScalef(SIZE, SIZE, SIZE);
		
		gl.glRotatef(zSkew, 0, 0, 1);
		gl.glRotatef(rotation, 1, 0, 0);
		gl.glRotatef(rotation, 0, 1, 0);
		gl.glColor4f(colour[0], colour[1], colour[2], 0.0f);
		cube.draw(gl);
		gl.glPopMatrix();
	}
}
